package com.monise.dao.DAO;

import java.sql.Date;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import com.monise.dao.BaseDao.GenericDao;
import com.monise.model.RetiradaCaixa;

public class RetiradaCaixaDAO extends GenericDao<RetiradaCaixa> {
	
	public List<RetiradaCaixa> getRetiradas(Date data){
		EntityManager manager = getEntityManager();
		
		manager.getTransaction().begin();
        Query query = manager.createQuery("SELECT a from RetiradaCaixa a where a.dataRetirada=:data");
		query.setParameter("data",data);

		@SuppressWarnings("unchecked")
	    List<RetiradaCaixa> retiradas = query.getResultList();

		manager.getTransaction().commit();
		manager.close();
		
		return retiradas;
	}

}
